﻿using KseCms.Core;

namespace KseCms.Application
{
    public class SystemService : ISystemService, ITransient
    {
        private readonly IRepository<User> _userRepository;

        public SystemService(IRepository<User> userRepository)
        {
            _userRepository = userRepository;
        }

        public UserDto FindUser(LoginUserDto user)
        {
            var entity= _userRepository.FirstOrDefault(u => u.Email == user.Email
            && u.Password == user.Password);

            return entity.Adapt<UserDto>();
        }
    }
}